package cn.java86.myschool.service;

import cn.java86.myschool.dao.GradeDao;
import cn.java86.myschool.entity.Grade;
import cn.java86.myschool.entity.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
@Service
public class GradeService implements GradeServiceI {
    @Autowired
    private GradeDao gradeDao;

    //查询所有
    @Override
    public List<Grade> findAll() {
        return gradeDao.getAll();
    }

    @Override
    public Page<Grade> paging(int pageNo, int pageSize, String gname) {
           List<Grade> list = gradeDao.paging(pageNo, pageSize, gname);
            long total = this.gradeDao.pageTotal(gname);
            return new Page<>(list, pageNo, total,pageSize);

    }
}
